package io.mya.modules.sys.controller;

import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.mya.modules.customer.entity.CustomerEntity;
import io.mya.modules.sys.entity.SysUserEntity;

/**
 * Controller公共组件
 * 
 * @author PGmm
 * @email yangmeifm@gmail.com
 * @date 2017/09/12 23:00:00
 */
public abstract class AbstractController {
	protected Logger logger = LoggerFactory.getLogger(getClass());
	
	protected SysUserEntity getUser() {
		return (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
	}

	protected Long getUserId() {
		return getUser().getUserId();
	}

	//获取用户和id信息
	protected CustomerEntity getCustomer() {
		return (CustomerEntity) SecurityUtils.getSubject().getPrincipal();
	}
	
	protected Long getCid() {
		return getCustomer().getId();
	}

}
